﻿@model IEnumerable<JuniorProject.Models.Employee.EmployeeQuestionModel>

@{
    ViewBag.Title = "ViewQuestions";
}

@section scripts
{
    <script src="~/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script language="javascript">
        $(document).ready(function () {
            $(".content").hide();
            $(".collapsible_heading").click(function () {
                $(this).next(".content").slideToggle(100);
            });
        });
    </script>   

    <link href="@Url.Content("~/Content/themes/base/jquery-tablesorter.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.tablesorter.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('table').tablesorter({ headers: { 2: { sorter: false} }, sortList: [[0, 0]] });
        });
    </script>
}

<h2>View All Questions</h2>
<h4>Click on a Question to View Possible Answers</h4>
<br />

<table id="table" class="tablesorter">
    <thead>
        <tr>
            <th>
                ID
            </th>
            <th>
                Question
            </th>
        </tr>
    </thead>
    <tbody>
@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ID)
        </td>
        <td>
            <div class="toggle">
                <div class="collapsible_heading">
                    <div class="collapsible_heading_text">
                        @Html.DisplayFor(modelItem => item.Question)
                    </div>
                </div>
                <div class="content">
                    @foreach (var answer in item.Answers)
                    {
                        @answer.Answer <br />
                    }
                </div>
            </div>
        </td>
    </tr>
}
    </tbody>
</table> 

<br />
@if (string.Equals(ViewData["AccessLevel"], "6") || string.Equals(ViewData["AccessLevel"], "2"))
{
    @Html.ActionLink("Add Question", "AddQuestion", new { AccessLevel = ViewData["AccessLevel"] })<br />
}
<p>
    @Html.Partial("_EmployeeBottomNavBar", ViewData["AccessLevel"])
</p>